package com.exam.demo.util;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * 功能描述
 *
 * @author yxj30
 * @date 2022/03/20  13:54
 */
public class NameMap {

    /**
     * 反向根据value获取key
     * @param map
     * @param value
     * @return
     */
    public static String getKey(Map<String, String> map, Object value) {
        value = value.toString();
        List<String> keyList = new ArrayList<>();
        for (String key : map.keySet()) {
            if (map.get(key).equals(value)) {
                keyList.add(key);
            }
        }
        if (keyList.size() != 1) {
            System.out.println("替换失败");
            return null;
        }
        return keyList.get(0);
    }
    /**
     * 获取admin表格键值对
     *
     * @return
     */
    public static Map<String, String> getAdminNameMap() {
        Map<String, String> nameMap = new LinkedHashMap();
        nameMap.put("id", "id");
        nameMap.put("adminId", "用户名");
        nameMap.put("adminPassword", "密码");
        nameMap.put("adminName", "姓名");
        nameMap.put("adminAddress", "地址");
        nameMap.put("useStatus", "使用状态");
        nameMap.put("adminTel", "电话");
        return nameMap;
    }
    /**
     * 获取student表格键值对
     *
     * @return
     */
    public static Map<String, String> getStudentNameMap() {
        Map<String, String> nameMap = new LinkedHashMap();
        nameMap.put("id", "id");
        nameMap.put("studentId", "用户名");
        nameMap.put("studentPassword", "密码");
        nameMap.put("studentName", "姓名");
        nameMap.put("studentSex", "性别");
        nameMap.put("studentAddress", "地址");
        nameMap.put("useStatus", "使用状态");
        nameMap.put("studentTel", "电话");
        nameMap.put("collegeId", "学院ID");
        nameMap.put("collegeName", "学院名称");
        nameMap.put("majorId", "专业ID");
        nameMap.put("majorName", "专业名称");
        return nameMap;
    }

    /**
     * 获取question表格键值对
     *
     * @return
     */
    public static Map<String, String> getQuestionNameMap() {
        Map<String, String> nameMap = new LinkedHashMap();
        nameMap.put("questionId", "题号");
        nameMap.put("questionType", "题目类型（1.单选题 2.多选题 3.判断题 4.简答题）");
        nameMap.put("teacherId", "出题老师账号");
        nameMap.put("teacherName", "出题老师姓名");
        nameMap.put("courseId", "课程号");
        nameMap.put("courseName", "课程名称");
        nameMap.put("questionTitle", "题干");
        nameMap.put("optionA", "A");
        nameMap.put("optionB", "B");
        nameMap.put("optionC", "C");
        nameMap.put("optionD", "D");
        nameMap.put("score", "题目分数");
        nameMap.put("parse", "解析");
        nameMap.put("correctAnswer", "正确答案");
        nameMap.put("difficult", "难度");
        nameMap.put("useStatus", "使用状态");
        nameMap.put("infoTextContentId", "补充信息");
        return nameMap;
    }

    /**
     * 获取course表格键值对
     *
     * @return
     */
    public static Map<String, String> getCourseNameMap() {
        Map<String, String> nameMap = new LinkedHashMap();
        nameMap.put("id", "id");
        nameMap.put("courseId", "用户名");
        nameMap.put("coursePassword", "密码");
        nameMap.put("courseName", "姓名");
        nameMap.put("courseSex", "性别");
        nameMap.put("courseAddress", "地址");
        nameMap.put("useStatus", "使用状态");
        nameMap.put("courseTel", "电话");
        nameMap.put("collegeId", "学院ID");
        nameMap.put("collegeName", "学院名称");
        nameMap.put("majorId", "专业ID");
        nameMap.put("majorName", "专业名称");
        return nameMap;
    }

    /**
     * 获取paper表格键值对
     *
     * @return
     */
    public static Map<String, String> getPaperNameMap() {
        Map<String, String> nameMap = new LinkedHashMap();
        nameMap.put("id", "id");
        nameMap.put("paperId", "用户名");
        nameMap.put("paperPassword", "密码");
        nameMap.put("paperName", "姓名");
        nameMap.put("paperSex", "性别");
        nameMap.put("paperAddress", "地址");
        nameMap.put("useStatus", "使用状态");
        nameMap.put("paperTel", "电话");
        nameMap.put("collegeId", "学院ID");
        nameMap.put("collegeName", "学院名称");
        nameMap.put("majorId", "专业ID");
        nameMap.put("majorName", "专业名称");
        return nameMap;
    }

    /**
     * 获取selectCourse表格键值对
     *
     * @return
     */
    public static Map<String, String> getSelectCourseNameMap() {
        Map<String, String> nameMap = new LinkedHashMap();
        nameMap.put("id","ID");
        nameMap.put("studentId","学号");
        nameMap.put("studentName","姓名");
        nameMap.put("courseId","课程号");
        return nameMap;
    }
}
